<?php
import( 'de.ceus-media.database.StatementCollection' );
/**
 *	Collection of SQL Statements fur Role Queries.
 *	@package		mv2.collection
 *	@extends		Database_StatementCollection
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			29.08.2007
 *	@version		0.1
 */
/**
 *	Collection of SQL Statements fur Role Queries.
 *	@package		mv2.collection
 *	@extends		Database_StatementCollection
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			29.08.2007
 *	@version		0.1
 */
class Collection_Role extends Database_StatementCollection
{
	public function collectRoles()
	{
		$keys	= array(
			"DISTINCT r.roleId",
			"r.title",
			"r.description",
			"r.created",
			"r.modified",
		);
		$tables	= array(
			"roles as r",
		);
		$conditions	= array(
		);
		$this->builder->addKeys( $keys );
		$this->builder->addTables( $tables );
		$this->builder->addConditions( $conditions );
	}
		
	public function withID( $id )
	{
		$condition	= "r.roleId=".(int)$id;
		$this->builder->addCondition( $condition );
	}

	public function withTitle( $title )
	{
		$condition	= "r.title LIKE '%".$title."%'";
		$this->builder->addCondition( $condition );
	}	
}
?>
